# encoding = cp936

import xlrd
import xlwt

"""读取xls表格数据"""

xls_read = xlrd.open_workbook('LBS1.xlsx')
#取第一个sheet
booksheet = xls_read.sheet_by_index(0)
#读取有效行数
rows_count = booksheet.nrows
print('一共有%d行'%rows_count)

#读取的数据写入到另一个表格
xls_write = xlwt.Workbook(encoding='utf-8')
#添加sheet表
booksheet_w = xls_write.add_sheet('测试点',cell_overwrite_ok=True)
#读单元格数据
for row in range(1,rows_count):
    #print(row)
    cell_r1 = booksheet.cell_value(row,1)
    cell_r2 = booksheet.cell_value(row,2)
    cell_r4 = booksheet.cell_value(row,4)
    print(cell_r1,cell_r2,cell_r4)
    booksheet_w.write(row,1,cell_r1+':'+cell_r2)
    booksheet_w.write(row,2,cell_r4)
xls_write.save('test_write.xlsx')

print('hello')
